﻿/**********************************************************************
 * @file   FITKAcousticsCSVParameter.h
 * @brief  求解中间量参数声明
 * @author liuzhonghua (liuzhonghuaszch@163.com)
 * @date   2025-02-14
 *********************************************************************/
#ifndef FITKACOUSTICSCSVPARAMETER_H
#define FITKACOUSTICSCSVPARAMETER_H

#include "FITKAcousticsPostDataAPI.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataObject.h"
#include "FITK_Kernel/FITKCore/FITKAbstractDataManager.hpp"

namespace Acoustics
{
    /**
     * @brief  求解中间量参数
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2025-02-10
     */
    class FITKAcousticsPostDataAPI FITKAcousticsCSVParameter : public Core::FITKAbstractDataObject
    {
    public:
        /**
         * @brief  参数类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-14
         */
        enum CSVParameterType
        {
            ParaNone = 0,                  ///无
            ModalDensity,                  ///模态密度
            LossFactor,                    ///损耗因子
            CLF,                           ///Coupling Loss Factor耦合损耗因子
            RadiationEfficiency,           ///辐射效率
        };

        /**
         * @brief  Construct a new FITKAcousticsCSVParameter object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-10
         */
        explicit FITKAcousticsCSVParameter() = default;
        /**
         * @brief  Destroy the FITKAcousticsCSVParameter object
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-10
         */
        virtual ~FITKAcousticsCSVParameter() = default;
        /**
         * @brief    设置参数类型
         * @param[i] type 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        void setCSVParameterType(CSVParameterType type);
        /**
         * @brief    获取参数类型
         * @return   CSVParameterType
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        CSVParameterType getCSVParameterType();
        /**
         * @brief    设置数据对象的ID 子系统/连接
         * @param[i] objID 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-10
         */
        void setObjID(int objID);
        /**
         * @brief    获取数据对象的ID 子系统/连接
         * @return   int
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-10
         */
        int getObjID();
        /**
         * @brief    获取数据对象的名称
         * @return   QString
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        QString getObjName();
        /**
         * @brief    获取频率
         * @return   std::vector<float>
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        std::vector<float> getFrequency() const;
        /**
         * @brief   获取数据集
         * @return  数据集
         * @author  liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-10
         */
        QHash<QString, std::vector<float>> getParameterValues() const;
        /**
         * @brief    插入数据集
         * @param[i] name 描述
         * @param[i] val  数据
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-10
         */
        void insertParameterValue(QString name, std::vector<float> val);

    private:
        /**
         * @brief  参数类型
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-14
         */
        CSVParameterType _type{ CSVParameterType::ParaNone };
        /**
         * @brief  对应的数据对象ID
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-10
         */
        int _objID{ 0 };
        /**
         * @brief  描述, 参数数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-10
         */
        QHash<QString, std::vector<float>> _parameterList{};
    };

    /**
     * @brief  求解中间量参数管理器
     * @author liuzhonghua (liuzhonghuaszch@163.com)
     * @date   2025-02-10
     */
    class FITKAcousticsPostDataAPI FITKAcousticsCSVParameterManager : public Core::FITKAbstractDataObject,
        public Core::FITKAbstractDataManager<FITKAcousticsCSVParameter>
    {
    public:
        /**
         * @brief Construct a new FITKAcousticsCSVParameterManager object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        explicit FITKAcousticsCSVParameterManager() = default;
        /**
         * @brief Destroy the FITKAcousticsCSVParameterManager object
         * @author LiBaojun (libaojunqd@foxmail.com)
         * @date 2024-10-15
         */
        virtual ~FITKAcousticsCSVParameterManager() = default;
        /**
         * @brief    通过数据对象ID和参数类型获取对应的参数数据
         * @param[i] objID 
         * @param[i] type 参数类型
         * @return   FITKAcousticsCSVParameter *
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        FITKAcousticsCSVParameter* getCSVParameterData(int objID, FITKAcousticsCSVParameter::CSVParameterType type);
        /**
         * @brief    设置频率
         * @param[i] frequency 
         * @return   void
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        void setFrequency(std::vector<float> frequency);
        /**
         * @brief    获取频率
         * @return   std::vector<float>
         * @author   liuzhonghua (liuzhonghuaszch@163.com)
         * @date     2025-02-14
         */
        std::vector<float> getFrequency() const;

    private:
        /**
         * @brief  频率数据
         * @author liuzhonghua (liuzhonghuaszch@163.com)
         * @date   2025-02-14
         */
        std::vector<float> _frequency{};
    };
}

#endif // FITKACOUSTICSCSVPARAMETER_H
